package win.zxshuo.www.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import win.zxshuo.www.model.BookModel;
import win.zxshuo.www.model.TargetUrlModel;

@Repository
public interface TargetUrlRepository extends JpaRepository<TargetUrlModel,Long> {

    @Query(value = "SELECT * FROM targeturl WHERE bookid=?1 and status=1",nativeQuery = true)
    public TargetUrlModel findActiveTargetUrl(Long bookid);

    public TargetUrlModel findByBookModel(BookModel bookModel);

    public TargetUrlModel findByBookModelAndUrl(BookModel bookModel, String url);
}
